﻿<local:BaseWindow
    x:Class="LenovoLegionToolkit.WPF.Windows.Utils.UpdateWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:LenovoLegionToolkit.WPF.Windows"
    xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf"
    xmlns:resources="clr-namespace:LenovoLegionToolkit.WPF.Resources"
    xmlns:utils="clr-namespace:LenovoLegionToolkit.WPF.Utils"
    xmlns:wpfui="http://schemas.lepo.co/wpfui/2022/xaml"
    Title="{x:Static resources:Resource.UpdateWindow_Title}"
    MinWidth="800"
    MinHeight="600"
    MaxWidth="800"
    MaxHeight="600"
    Closing="UpdateWindow_Closing"
    ExtendsContentIntoTitleBar="True"
    FlowDirection="{x:Static utils:LocalizationHelper.Direction}"
    Loaded="UpdateWindow_Loaded"
    ResizeMode="NoResize"
    ShowInTaskbar="False"
    WindowStartupLocation="CenterOwner">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <wpfui:TitleBar
            Grid.Row="0"
            CanMaximize="false"
            ShowMaximize="false"
            ShowMinimize="false"
            UseSnapLayout="false" />

        <Grid
            Grid.Row="0"
            Height="24"
            Margin="12,8,12,8">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBlock
                Grid.Column="0"
                VerticalAlignment="Center"
                FontSize="12"
                IsHitTestVisible="False"
                Text="{x:Static resources:Resource.UpdateWindow_Title}" />

        </Grid>

        <Grid Grid.Row="1" Margin="16,12,16,12">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <TextBlock
                    Grid.Row="0"
                    Margin="0,0,0,24"
                    FontSize="24"
                    FontWeight="Medium"
                    Text="{x:Static resources:Resource.UpdateWindow_WhatsNew}" />

                <markdig:MarkdownViewer x:Name="_markdownViewer" Grid.Row="1" />

                <ProgressBar
                    x:Name="_downloadProgressBar"
                    Grid.Row="2"
                    Margin="0,16,0,16"
                    IsIndeterminate="True"
                    Maximum="1"
                    Minimum="0"
                    Visibility="Hidden" />

                <Button
                    x:Name="_downloadButton"
                    Grid.Row="3"
                    Width="150"
                    Height="32"
                    Margin="0,0,0,16"
                    HorizontalAlignment="Center"
                    Click="DownloadButton_Click"
                    Content="{x:Static resources:Resource.Update}"
                    IsEnabled="False" />

                <Button
                    x:Name="_cancelDownloadButton"
                    Grid.Row="4"
                    Width="150"
                    Height="32"
                    Margin="0,0,0,16"
                    HorizontalAlignment="Center"
                    Click="CancelDownloadButton_Click"
                    Content="{x:Static resources:Resource.Cancel}"
                    IsEnabled="False"
                    Visibility="Collapsed" />
            </Grid>
        </Grid>
    </Grid>
</local:BaseWindow>
